@echo off
chcp 65001 > nul
title UC系统重启器

echo ====================================
echo     UC系统服务重启脚本
echo ====================================
echo.

echo [1/4] 停止所有现有服务...
taskkill /f /im node.exe 2>nul
taskkill /f /im python.exe 2>nul
timeout /t 2 /nobreak > nul

echo [2/4] 启动AI推理服务...
cd /d "%~dp0endo_sight_uc_ai"
start "AI推理服务" cmd /k "python inference_server.py"
timeout /t 3 /nobreak > nul

echo [3/4] 启动后端API服务...
cd /d "%~dp0"
start "后端服务" cmd /k "node simple_test_server.js"
timeout /t 3 /nobreak > nul

echo [4/4] 启动前端Web服务...
cd /d "%~dp0endo_sight_uc_web"
start "前端服务" cmd /k "npm run dev"

echo.
echo ====================================
echo     服务重启完成！
echo ====================================
echo.
echo 服务访问地址：
echo - 前端界面: http://localhost:8102
echo - 后端API: http://localhost:4000/api/health
echo - AI服务: http://localhost:5001/health
echo.
echo 请等待30秒让所有服务完全启动
echo.
pause
